﻿// <copyright file="PredefineCollection.cs" company="TenneySoftware">
// Copyright (c) 2009 All Right Reserved
// </copyright>
// <author>Robert Tenney</author>
// <email>rob10e@yahoo.com</email>
// <date>April 2009</date>
// <summary>Collection that stores the predefined lists.</summary>

// License:

// Product: RPGRoguelikeEngine .Net
// Author: Robert N. Tenney
// Copyright: April 2009

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation version 2
// of the License.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

// This license covers all source code, binaries, and other materials related to this project
// unless specifically stated otherwise.

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace TenneySoftware.LevelGenerator {
    /// <summary>
    /// Collection that stores the predefined lists.
    /// </summary>
    public class PredefineCollection : Collection<GeneratorData> {
        /// <summary>
        /// Initializes a new instance of the PredefineCollection class.
        /// </summary>
        public PredefineCollection() : base(new List<GeneratorData>()) {
        }

        /// <summary>
        /// Adds a collection to the current one.
        /// </summary>
        /// <param name="collection">Collection to add.</param>
        public void AddRange(IEnumerable<GeneratorData> collection) {
            (Items as List<GeneratorData>).AddRange(collection);
        }

        /// <summary>
        /// Uses the predicate to find an item within the collection.
        /// </summary>
        /// <param name="match">The predicate to search with.</param>
        /// <returns>The item if found, or null if nothing was found.</returns>
        public GeneratorData Find(Predicate<GeneratorData> match) {
            return (Items as List<GeneratorData>).Find(match);
        }
    }
}
